<?php


/*
* Copyright (c) 2008-2016 vip.com, All Rights Reserved.
*
* Powered by com.vip.osp.osp-idlc-2.5.11.
*
*/

namespace com\vip\vipcard;

class ConsumeReqModel {
	
	static $_TSPEC;
	public $signModel = null;
	public $traceId = null;
	public $orderSn = null;
	public $prepaidCardMoney = null;
	public $giftCardMoney = null;
	public $goodsMoney = null;
	public $userId = null;
	public $version = null;
	public $areaCode = null;
	public $clientJsonMsg = null;
	public $extJsonMsg = null;
	public $consumePrepaidCards = null;
	public $consumeGiftCards = null;
	
	public function __construct($vals=null){
		
		if (!isset(self::$_TSPEC)){
			
			self::$_TSPEC = array(
			101 => array(
			'var' => 'signModel'
			),
			1 => array(
			'var' => 'traceId'
			),
			2 => array(
			'var' => 'orderSn'
			),
			3 => array(
			'var' => 'prepaidCardMoney'
			),
			4 => array(
			'var' => 'giftCardMoney'
			),
			5 => array(
			'var' => 'goodsMoney'
			),
			6 => array(
			'var' => 'userId'
			),
			7 => array(
			'var' => 'version'
			),
			8 => array(
			'var' => 'areaCode'
			),
			9 => array(
			'var' => 'clientJsonMsg'
			),
			10 => array(
			'var' => 'extJsonMsg'
			),
			11 => array(
			'var' => 'consumePrepaidCards'
			),
			12 => array(
			'var' => 'consumeGiftCards'
			),
			
			);
			
		}
		
		if (is_array($vals)){
			
			
			if (isset($vals['signModel'])){
				
				$this->signModel = $vals['signModel'];
			}
			
			
			if (isset($vals['traceId'])){
				
				$this->traceId = $vals['traceId'];
			}
			
			
			if (isset($vals['orderSn'])){
				
				$this->orderSn = $vals['orderSn'];
			}
			
			
			if (isset($vals['prepaidCardMoney'])){
				
				$this->prepaidCardMoney = $vals['prepaidCardMoney'];
			}
			
			
			if (isset($vals['giftCardMoney'])){
				
				$this->giftCardMoney = $vals['giftCardMoney'];
			}
			
			
			if (isset($vals['goodsMoney'])){
				
				$this->goodsMoney = $vals['goodsMoney'];
			}
			
			
			if (isset($vals['userId'])){
				
				$this->userId = $vals['userId'];
			}
			
			
			if (isset($vals['version'])){
				
				$this->version = $vals['version'];
			}
			
			
			if (isset($vals['areaCode'])){
				
				$this->areaCode = $vals['areaCode'];
			}
			
			
			if (isset($vals['clientJsonMsg'])){
				
				$this->clientJsonMsg = $vals['clientJsonMsg'];
			}
			
			
			if (isset($vals['extJsonMsg'])){
				
				$this->extJsonMsg = $vals['extJsonMsg'];
			}
			
			
			if (isset($vals['consumePrepaidCards'])){
				
				$this->consumePrepaidCards = $vals['consumePrepaidCards'];
			}
			
			
			if (isset($vals['consumeGiftCards'])){
				
				$this->consumeGiftCards = $vals['consumeGiftCards'];
			}
			
			
		}
		
	}
	
	
	public function getName(){
		
		return 'ConsumeReqModel';
	}
	
	public function read($input){
		
		$input->readStructBegin();
		while(true){
			
			$schemeField = $input->readFieldBegin();
			if ($schemeField == null) break;
			$needSkip = true;
			
			
			if ("signModel" == $schemeField){
				
				$needSkip = false;
				
				$this->signModel = new \com\vip\vipcard\SignModel();
				$this->signModel->read($input);
				
			}
			
			
			
			
			if ("traceId" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->traceId);
				
			}
			
			
			
			
			if ("orderSn" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->orderSn);
				
			}
			
			
			
			
			if ("prepaidCardMoney" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->prepaidCardMoney);
				
			}
			
			
			
			
			if ("giftCardMoney" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->giftCardMoney);
				
			}
			
			
			
			
			if ("goodsMoney" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->goodsMoney);
				
			}
			
			
			
			
			if ("userId" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->userId);
				
			}
			
			
			
			
			if ("version" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->version);
				
			}
			
			
			
			
			if ("areaCode" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->areaCode);
				
			}
			
			
			
			
			if ("clientJsonMsg" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->clientJsonMsg);
				
			}
			
			
			
			
			if ("extJsonMsg" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->extJsonMsg);
				
			}
			
			
			
			
			if ("consumePrepaidCards" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->consumePrepaidCards);
				
			}
			
			
			
			
			if ("consumeGiftCards" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->consumeGiftCards);
				
			}
			
			
			
			if($needSkip){
				
				\Osp\Protocol\ProtocolUtil::skip($input);
			}
			
			$input->readFieldEnd();
		}
		
		$input->readStructEnd();
		
		
		
	}
	
	public function write($output){
		
		$xfer = 0;
		$xfer += $output->writeStructBegin();
		
		if($this->signModel !== null) {
			
			$xfer += $output->writeFieldBegin('signModel');
			
			if (!is_object($this->signModel)) {
				
				throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
			}
			
			$xfer += $this->signModel->write($output);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		$xfer += $output->writeFieldBegin('traceId');
		$xfer += $output->writeString($this->traceId);
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldBegin('orderSn');
		$xfer += $output->writeString($this->orderSn);
		
		$xfer += $output->writeFieldEnd();
		
		if($this->prepaidCardMoney !== null) {
			
			$xfer += $output->writeFieldBegin('prepaidCardMoney');
			$xfer += $output->writeString($this->prepaidCardMoney);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->giftCardMoney !== null) {
			
			$xfer += $output->writeFieldBegin('giftCardMoney');
			$xfer += $output->writeString($this->giftCardMoney);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		$xfer += $output->writeFieldBegin('goodsMoney');
		$xfer += $output->writeString($this->goodsMoney);
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldBegin('userId');
		$xfer += $output->writeString($this->userId);
		
		$xfer += $output->writeFieldEnd();
		
		if($this->version !== null) {
			
			$xfer += $output->writeFieldBegin('version');
			$xfer += $output->writeString($this->version);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->areaCode !== null) {
			
			$xfer += $output->writeFieldBegin('areaCode');
			$xfer += $output->writeString($this->areaCode);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->clientJsonMsg !== null) {
			
			$xfer += $output->writeFieldBegin('clientJsonMsg');
			$xfer += $output->writeString($this->clientJsonMsg);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->extJsonMsg !== null) {
			
			$xfer += $output->writeFieldBegin('extJsonMsg');
			$xfer += $output->writeString($this->extJsonMsg);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->consumePrepaidCards !== null) {
			
			$xfer += $output->writeFieldBegin('consumePrepaidCards');
			$xfer += $output->writeString($this->consumePrepaidCards);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->consumeGiftCards !== null) {
			
			$xfer += $output->writeFieldBegin('consumeGiftCards');
			$xfer += $output->writeString($this->consumeGiftCards);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		$xfer += $output->writeFieldStop();
		$xfer += $output->writeStructEnd();
		return $xfer;
	}
	
}

?>